<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>交通气象预警平台</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <link rel="stylesheet" href="${request.contextPath}/statics/css/bootstrap.min.css">
  <link rel="stylesheet" href="${request.contextPath}/statics/css/font-awesome.min.css">
  <link rel="stylesheet" href="${request.contextPath}/statics/css/AdminLTE.min.css">
  <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
  <link rel="stylesheet" href="${request.contextPath}/statics/css/all-skins.min.css">
  <link rel="stylesheet" href="${request.contextPath}/statics/css/main.css">
  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->
</head>
<body class="hold-transition login-page" style="background: url('${request.contextPath}/statics/image/login_bg.png');background-size: 100%;">
<div style="width: 53%;position: absolute;margin-top:60px;overflow: hidden">
    <img src="statics/image/login_modification.png" alt="" style="width: 100%;margin-left: 56px">
</div>
<div class="login-box" id="rrapp" v-cloak style="margin:13% 54%">
  <div class="login-logo">
    <b>
        <img src="statics/image/login_title.png" alt="">
    </b>
  </div>
  <!-- /.login-logo -->
  <div class="login-box-body" style="background-image: url('statics/image/login_box.png') ;
  background-size:100% 100%;width:115%;background-color: rgba(32, 163, 245, 0.0);padding: 30px">
      <p class="login-box-msg" style="color: #00bff4;font-size: 22px;letter-spacing:2px">管理员登录</p>
<!--      <div v-if="error" class="alert alert-danger alert-dismissible">-->
<!--        <h4 style="margin-bottom: 0px;"><i class="fa fa-exclamation-triangle"></i> {{errorMsg}}</h4>-->
<!--      </div>-->
      <div class="form-group has-feedback" style="margin:12px 0px;">
        <input type="text" class="form-control" v-model="username" placeholder="账号"
               style=" background-color: rgba(32, 163, 245, 0.3);border:2px solid rgb(32, 163, 245, 0.4);color: #fff;height: 38px;padding:2px 0 0 28px;">
        <span class="glyphicon  form-control-feedback"style="position:absolute;top: 0;left: 0;"><img src="${request.contextPath}statics/image/login_name.png" alt=""></span>
      </div>
      <div class="form-group has-feedback"style="margin:16px 0px 0px 0px;">
        <input type="password" class="form-control" v-model="password" placeholder="密码"
               style="background-color: rgba(32, 163, 245, 0.3);border:2px solid rgb(32, 163, 245, 0.4);color: #fff;height: 38px;padding:4px 0 0 28px;">
        <span class="glyphicon  form-control-feedback" style="position:absolute;top: 0;left: 0;"><img src="${request.contextPath}statics/image/login_password.png" alt=""></span>
      </div>

      <div class="row" style="border: none;padding: 0px 2px">
        <div class="col-xs-8">
          <div class="checkbox icheck">
          </div>
        </div>
          <div v-if="error" class="alert  alert-dismissible" style="padding: 9px 0px 0px 0px;margin: 0px">
                  <h4 style="margin-bottom: 0px;font-size: 14px;color: red;font-weight:400"><i class="fa fa-exclamation-triangle"></i> {{errorMsg}}</h4>
          </div>
        <!-- /.col -->
        <div class="col-xs-4"style="width: 100%;height:66px;padding: 20px 0px 0px 0px ;">
          <button type="button" class="btn btn-primary btn-block btn-flat" @click="login" style="background-color: #20a3f5;height: 100%;font-size: 16px">登 录</button>
        </div>
        <!-- /.col -->
      </div>
    <!-- /.social-auth-links -->

  </div>
  <!-- /.login-box-body -->
</div>
<!-- /.login-box -->
<script src="${request.contextPath}/statics/libs/jquery.min.js"></script>
<script src="${request.contextPath}/statics/libs/vue.min.js"></script>
<script src="${request.contextPath}/statics/libs/bootstrap.min.js"></script>
<script src="${request.contextPath}/statics/libs/jquery.slimscroll.min.js"></script>
<script src="${request.contextPath}/statics/libs/fastclick.min.js"></script>
<script src="${request.contextPath}/statics/libs/app.js"></script>
<script type="text/javascript">
var vm = new Vue({
	el:'#rrapp',
	data:{
		username: '',
		password: '',
		captcha: '',
		error: false,
		errorMsg: '',
		src: 'captcha.jpg'
	},
	beforeCreate: function(){
		if(self != top){
			top.location.href = self.location.href;
		}
	},
	methods: {
		refreshCode: function(){
			this.src = "captcha.jpg?t=" + $.now();
		},
		login: function (event) {
			var data = "username="+vm.username+"&password="+vm.password+"&captcha="+vm.captcha;
			$.ajax({
				type: "POST",
			    url: "sys/login",
			    data: data,
			    dataType: "json",
			    success: function(result){
					if(result.code == 0){//登录成功
						parent.location.href ='indexBr.html';
					}else{
						vm.error = true;
						vm.errorMsg = result.msg;
						
						//vm.refreshCode();
					}
				}
			});
		}
	}
});
$(document).keyup(function (e) {//捕获文档对象的按键弹起事件
    if (e.keyCode == 13) {//按键信息对象以参数的形式传递进来了
        vm.login();
    }
});
</script>
</body>
</html>
